package org.wu.reggie.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.wu.reggie.entity.Employee;

import java.util.List;

public interface EmployeeMapper {

    // 查询是否有该员工信息
    @Select("select * from employee where username= #{username}")
    Employee login(Employee employee);

    @Insert("insert into employee values(null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void save(Employee employee);

    @Select("select * from employee")
    List<Employee> list();

    // 查询包含关键词名字的员工信息
    List<Employee> findByName(@Param("name") String name);

    void update(Employee employee);

    @Select("select * from employee where id = #{id}")
    Employee findById(Long id);
}
